<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

  <title>Class: ServerSpecification</title>

  <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />

  <script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
  <script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
  <script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
  <script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>

</head>
<body id="top" class="class">

  <div id="metadata">
    <div id="home-metadata">
      <div id="home-section" class="section">
        <h3 class="section-header">
          <a href="./index.html">Home</a>
          <a href="./index.html#classes">Classes</a>
          <a href="./index.html#methods">Methods</a>
        </h3>
      </div>
    </div>

    <div id="file-metadata">
      <div id="file-list-section" class="section">
        <h3 class="section-header">In Files</h3>
        <div class="section-body">
          <ul>
          
            <li><a href="./app/models/server_specification_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
              class="thickbox" title="app/models/server_specification.rb">app/models/server_specification.rb</a></li>
          
          </ul>
        </div>
      </div>

      
    </div>

    <div id="class-metadata">
      
      <!-- Parent Class -->
      <div id="parent-class-section" class="section">
        <h3 class="section-header">Parent</h3>
        
        <p class="link"><a href="Object.html">Object</a></p>
        
      </div>
      

      

      

      
      <!-- Method Quickref -->
      <div id="method-list-section" class="section">
        <h3 class="section-header">Methods</h3>
        <ul class="link-list">
          
          <li><a href="#method-c-get_fields">::get_fields</a></li>
          
          <li><a href="#method-c-get_hash">::get_hash</a></li>
          
          <li><a href="#method-c-validate_and_write">::validate_and_write</a></li>
          
          <li><a href="#method-c-write">::write</a></li>
          
        </ul>
      </div>
      

      
    </div>

    <div id="project-metadata">
      
      
      <div id="fileindex-section" class="section project-section">
        <h3 class="section-header">Files</h3>
        <ul>
        
          <li class="file"><a href="./doc/README_FOR_APP.html">README_FOR_APP</a></li>
        
        </ul>
      </div>
      

      <div id="classindex-section" class="section project-section">
        <h3 class="section-header">Class/Module Index
          <span class="search-toggle"><img src="./images/find.png"
            height="16" width="16" alt="[+]"
            title="show/hide quicksearch" /></span></h3>
        <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
        <fieldset>
          <legend>Quicksearch</legend>
          <input type="text" name="quicksearch" value=""
            class="quicksearch-field" />
        </fieldset>
        </form>

        <ul class="link-list">
        
          <li><a href="./Analytics.html">Analytics</a></li>
        
          <li><a href="./Analytics/Database.html">Analytics::Database</a></li>
        
          <li><a href="./Analytics/ResourceUsage.html">Analytics::ResourceUsage</a></li>
        
          <li><a href="./Analytics/Throughput.html">Analytics::Throughput</a></li>
        
          <li><a href="./Analytics/Url.html">Analytics::Url</a></li>
        
          <li><a href="./Analytics/UrlBreakup.html">Analytics::UrlBreakup</a></li>
        
          <li><a href="./ActionView.html">ActionView</a></li>
        
          <li><a href="./ActionView/Helpers.html">ActionView::Helpers</a></li>
        
          <li><a href="./ActionView/Helpers/AssetTagHelper.html">ActionView::Helpers::AssetTagHelper</a></li>
        
          <li><a href="./AdminController.html">AdminController</a></li>
        
          <li><a href="./AdminHelper.html">AdminHelper</a></li>
        
          <li><a href="./App.html">App</a></li>
        
          <li><a href="./AppException.html">AppException</a></li>
        
          <li><a href="./AppTimeSample.html">AppTimeSample</a></li>
        
          <li><a href="./ApplicationController.html">ApplicationController</a></li>
        
          <li><a href="./ApplicationHelper.html">ApplicationHelper</a></li>
        
          <li><a href="./ApplicationSpecification.html">ApplicationSpecification</a></li>
        
          <li><a href="./ApplicationSpecificationController.html">ApplicationSpecificationController</a></li>
        
          <li><a href="./ApplicationSpecificationHelper.html">ApplicationSpecificationHelper</a></li>
        
          <li><a href="./Control.html">Control</a></li>
        
          <li><a href="./ExceptionDetail.html">ExceptionDetail</a></li>
        
          <li><a href="./ExceptionsController.html">ExceptionsController</a></li>
        
          <li><a href="./ExceptionsHelper.html">ExceptionsHelper</a></li>
        
          <li><a href="./GraphController.html">GraphController</a></li>
        
          <li><a href="./GraphHelper.html">GraphHelper</a></li>
        
          <li><a href="./Headers.html">Headers</a></li>
        
          <li><a href="./HeadersController.html">HeadersController</a></li>
        
          <li><a href="./HeadersHelper.html">HeadersHelper</a></li>
        
          <li><a href="./MailSpecification.html">MailSpecification</a></li>
        
          <li><a href="./MailSpecificationController.html">MailSpecificationController</a></li>
        
          <li><a href="./MailSpecificationHelper.html">MailSpecificationHelper</a></li>
        
          <li><a href="./Mailer.html">Mailer</a></li>
        
          <li><a href="./Object.html">Object</a></li>
        
          <li><a href="./PseudoModel.html">PseudoModel</a></li>
        
          <li><a href="./ResourceUsage.html">ResourceUsage</a></li>
        
          <li><a href="./SCGI.html">SCGI</a></li>
        
          <li><a href="./ServerSpecification.html">ServerSpecification</a></li>
        
          <li><a href="./ServerSpecificationController.html">ServerSpecificationController</a></li>
        
          <li><a href="./ServerSpecificationHelper.html">ServerSpecificationHelper</a></li>
        
          <li><a href="./SignalHelper.html">SignalHelper</a></li>
        
          <li><a href="./UrlBreakupTimeSample.html">UrlBreakupTimeSample</a></li>
        
          <li><a href="./UrlTimeSample.html">UrlTimeSample</a></li>
        
          <li><a href="./User.html">User</a></li>
        
          <li><a href="./YAMLConfig.html">YAMLConfig</a></li>
        
          <li><a href="./YAMLWriter.html">YAMLWriter</a></li>
        
        </ul>
        <div id="no-class-search-results" style="display: none;">No matching classes.</div>
      </div>

      
    </div>
  </div>

  <div id="documentation">
    <h1 class="class">ServerSpecification</h1>

    <div id="description" class="description">
      
    </div><!-- description -->

    
    
    
    <div id="5Buntitled-5D" class="documentation-section">
      

      

      

      

      <!-- Methods -->
      
      <div id="public-class-method-details" class="method-section section">
        <h3 class="section-header">Public Class Methods</h3>

      
        <div id="get_fields-method" class="method-detail ">
          <a name="method-c-get_fields"></a>

          
          <div class="method-heading">
            <span class="method-name">get_fields</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="get_fields-source">
<pre>
<span class="ruby-comment"># File app/models/server_specification.rb, line 98</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_fields</span>
  <span class="ruby-identifier">info</span> = <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load_file</span>(<span class="ruby-constant">CONFIG_FILE_PATH</span>) <span class="ruby-keyword">rescue</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">port</span> = <span class="ruby-constant">SERVER_PORT</span>
  <span class="ruby-identifier">min_worker</span> = <span class="ruby-constant">MIN_WORKERS</span>
  <span class="ruby-identifier">max_worker</span> = <span class="ruby-constant">MAX_WORKERS</span>                                                          
  <span class="ruby-identifier">log_level</span> = <span class="ruby-constant">LOG_LEVEL</span>
  <span class="ruby-identifier">access_log</span> = <span class="ruby-constant">ACCESS_LOG</span>
  <span class="ruby-identifier">ssl_support</span> = <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-identifier">ssl_port</span> = <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-identifier">certificate</span> = <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-identifier">key</span> = <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-keyword">if</span> (<span class="ruby-identifier">info</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>])
    <span class="ruby-identifier">port</span> = <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'port'</span>].<span class="ruby-identifier">to_i</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'port'</span>]
    <span class="ruby-identifier">min_worker</span> = <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'min_worker'</span>].<span class="ruby-identifier">to_i</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'min_worker'</span>]
    <span class="ruby-identifier">max_worker</span> = <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'max_worker'</span>].<span class="ruby-identifier">to_i</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'max_worker'</span>]
    <span class="ruby-identifier">log_level</span> = <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'log_level'</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'log_level'</span>]
    <span class="ruby-identifier">access_log</span> = <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'access_log'</span>].<span class="ruby-identifier">capitalize</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'access_log'</span>]
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'SSL Specification'</span>]
      <span class="ruby-identifier">ssl_support</span> = <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'SSL Specification'</span>][<span class="ruby-string">'ssl_support'</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'SSL Specification'</span>][<span class="ruby-string">'ssl_support'</span>]
      <span class="ruby-identifier">ssl_port</span> = <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'SSL Specification'</span>][<span class="ruby-string">'ssl_port'</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'SSL Specification'</span>][<span class="ruby-string">'ssl_port'</span>]
      <span class="ruby-identifier">certificate</span> = <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'SSL Specification'</span>][<span class="ruby-string">'certificate_file'</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'SSL Specification'</span>][<span class="ruby-string">'certificate_file'</span>]
      <span class="ruby-identifier">key</span> = <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'SSL Specification'</span>][<span class="ruby-string">'key_file'</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'SSL Specification'</span>][<span class="ruby-string">'key_file'</span>]
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">port</span>, <span class="ruby-identifier">min_worker</span>, <span class="ruby-identifier">max_worker</span>, <span class="ruby-identifier">log_level</span>, <span class="ruby-identifier">ssl_support</span>, <span class="ruby-identifier">ssl_port</span>, <span class="ruby-identifier">certificate</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">access_log</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- get_fields-source -->
            
          </div>

          

          
        </div><!-- get_fields-method -->

      
        <div id="get_hash-method" class="method-detail ">
          <a name="method-c-get_hash"></a>

          
          <div class="method-heading">
            <span class="method-name">get_hash</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="get_hash-source">
<pre>
<span class="ruby-comment"># File app/models/server_specification.rb, line 125</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_hash</span>      
  <span class="ruby-identifier">port</span>, <span class="ruby-identifier">min_worker</span>, <span class="ruby-identifier">max_worker</span>, <span class="ruby-identifier">log_level</span>, <span class="ruby-identifier">ssl_support</span>, <span class="ruby-identifier">ssl_port</span>, <span class="ruby-identifier">certificate</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">access_log</span> = <span class="ruby-identifier">get_fields</span>
  
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">ssl_support</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span>
    <span class="ruby-identifier">server_specification</span> = <span class="ruby-constant">Hash</span>[<span class="ruby-string">'port'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">port</span>, <span class="ruby-string">'min_worker'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">min_worker</span>, <span class="ruby-string">'max_worker'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">max_worker</span>, <span class="ruby-string">'log_level'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">log_level</span>, <span class="ruby-string">'access_log'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">access_log</span>.<span class="ruby-identifier">downcase</span>]
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">ssl_support</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;enabled&quot;</span>
    <span class="ruby-identifier">ssl_specification</span> = <span class="ruby-constant">Hash</span>[<span class="ruby-string">'ssl_support'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'enabled'</span> , <span class="ruby-string">'certificate_file'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">certificate</span>, <span class="ruby-string">'key_file'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">key</span>, <span class="ruby-string">'ssl_port'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ssl_port</span>]
    <span class="ruby-identifier">server_specification</span> = <span class="ruby-constant">Hash</span>[<span class="ruby-string">'port'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">port</span>, <span class="ruby-string">'min_worker'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">min_worker</span>, <span class="ruby-string">'max_worker'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">max_worker</span>, <span class="ruby-string">'log_level'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">log_level</span>, <span class="ruby-string">'access_log'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">access_log</span>.<span class="ruby-identifier">downcase</span>, <span class="ruby-string">'SSL Specification'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ssl_specification</span>]
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">ssl_specification</span> = <span class="ruby-constant">Hash</span>[<span class="ruby-string">'ssl_support'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'disabled'</span>, <span class="ruby-string">'certificate_file'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">certificate</span>, <span class="ruby-string">'key_file'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">key</span>, <span class="ruby-string">'ssl_port'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ssl_port</span>]
    <span class="ruby-identifier">server_specification</span> = <span class="ruby-constant">Hash</span>[<span class="ruby-string">'port'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">port</span>, <span class="ruby-string">'min_worker'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">min_worker</span>, <span class="ruby-string">'max_worker'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">max_worker</span>, <span class="ruby-string">'log_level'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">log_level</span>, <span class="ruby-string">'access_log'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">access_log</span>.<span class="ruby-identifier">downcase</span>, <span class="ruby-string">'SSL Specification'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ssl_specification</span>]
  <span class="ruby-keyword">end</span>      
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">server_specification</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- get_hash-source -->
            
          </div>

          

          
        </div><!-- get_hash-method -->

      
        <div id="validate_and_write-method" class="method-detail ">
          <a name="method-c-validate_and_write"></a>

          
          <div class="method-heading">
            <span class="method-name">validate_and_write</span><span
              class="method-args">(field, data)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="validate_and_write-source">
<pre>
<span class="ruby-comment"># File app/models/server_specification.rb, line 24</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">validate_and_write</span>(<span class="ruby-identifier">field</span>, <span class="ruby-identifier">data</span>)
  <span class="ruby-identifier">port</span>, <span class="ruby-identifier">min_worker</span>, <span class="ruby-identifier">max_worker</span>, <span class="ruby-identifier">log_level</span>, <span class="ruby-identifier">ssl_support</span>, <span class="ruby-identifier">ssl_port</span>, <span class="ruby-identifier">certificate</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">access_log</span> = <span class="ruby-constant">ServerSpecification</span>.<span class="ruby-identifier">get_fields</span>
  <span class="ruby-identifier">info</span> = <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load_file</span>(<span class="ruby-constant">CONFIG_FILE_PATH</span>) <span class="ruby-keyword">rescue</span> <span class="ruby-keyword">nil</span>      
  <span class="ruby-identifier">error_message</span> = <span class="ruby-string">''</span>
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">field</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">'port_div'</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">data</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^\d+$/</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">65535</span>
      <span class="ruby-identifier">port</span> = <span class="ruby-identifier">data</span>.<span class="ruby-identifier">to_i</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">error_message</span> = <span class="ruby-constant">SERVER_PORT_VALIDATION</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">text</span> = <span class="ruby-identifier">port</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">'min_pro_div'</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">data</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^\d+$/</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-constant">ALLOWED_MAX_WORKERS</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'max_worker'</span>].<span class="ruby-identifier">to_i</span>
      <span class="ruby-identifier">min_worker</span> = <span class="ruby-identifier">data</span>.<span class="ruby-identifier">to_i</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">error_message</span> = <span class="ruby-constant">MINIMUM_WORKERS_VALIDATION</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">text</span> = <span class="ruby-identifier">min_worker</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">'max_pro_div'</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">data</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^\d+$/</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-constant">ALLOWED_MAX_WORKERS</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>][<span class="ruby-string">'min_worker'</span>].<span class="ruby-identifier">to_i</span>
      <span class="ruby-identifier">max_worker</span> = <span class="ruby-identifier">data</span>.<span class="ruby-identifier">to_i</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">error_message</span> = <span class="ruby-constant">MAXIMUM_WORKERS_VALIDATION</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">text</span> = <span class="ruby-identifier">max_worker</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">'ssl_port_div'</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">data</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^\d+$/</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">65535</span>
      <span class="ruby-identifier">ssl_port</span> = <span class="ruby-identifier">data</span>.<span class="ruby-identifier">to_i</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">error_message</span> = <span class="ruby-constant">SSL_PORT_VALIDATION</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">text</span> = <span class="ruby-identifier">ssl_port</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">'certificate_div'</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-keyword">and</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">data</span>)
      <span class="ruby-identifier">certificate</span> = <span class="ruby-identifier">data</span>    
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">error_message</span> = <span class="ruby-constant">SSL_CERTIFICATE_FILE_PATH_VALIDATION1</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">text</span> = <span class="ruby-identifier">certificate</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">'key_div'</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-keyword">and</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">data</span>)
      <span class="ruby-identifier">key</span> = <span class="ruby-identifier">data</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">error_message</span> = <span class="ruby-constant">SSL_KEY_FILE_PATH_VALIDATION1</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">text</span> = <span class="ruby-identifier">key</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">'log_div'</span>
    <span class="ruby-identifier">log_level</span> = <span class="ruby-identifier">data</span>
    <span class="ruby-identifier">text</span> = <span class="ruby-identifier">log_level</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">'access_log_div'</span>
    <span class="ruby-identifier">access_log</span> = <span class="ruby-identifier">data</span>
    <span class="ruby-identifier">text</span> = <span class="ruby-identifier">access_log</span>
  <span class="ruby-keyword">end</span>       
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">ssl_support</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span>
    <span class="ruby-identifier">server_specification</span> = <span class="ruby-constant">Hash</span>[<span class="ruby-string">'port'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">port</span>, <span class="ruby-string">'min_worker'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">min_worker</span>, <span class="ruby-string">'max_worker'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">max_worker</span>, <span class="ruby-string">'log_level'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">log_level</span>, <span class="ruby-string">'access_log'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">access_log</span>.<span class="ruby-identifier">downcase</span>]
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">ssl_support</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;enabled&quot;</span>
    <span class="ruby-identifier">ssl_specification</span> = <span class="ruby-constant">Hash</span>[<span class="ruby-string">'ssl_support'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'enabled'</span>, <span class="ruby-string">'certificate_file'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">certificate</span>, <span class="ruby-string">'key_file'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">key</span>, <span class="ruby-string">'ssl_port'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ssl_port</span>]
    <span class="ruby-identifier">server_specification</span> = <span class="ruby-constant">Hash</span>[<span class="ruby-string">'port'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">port</span>, <span class="ruby-string">'min_worker'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">min_worker</span>, <span class="ruby-string">'max_worker'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">max_worker</span>, <span class="ruby-string">'log_level'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">log_level</span>, <span class="ruby-string">'access_log'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">access_log</span>.<span class="ruby-identifier">downcase</span>, <span class="ruby-string">'SSL Specification'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ssl_specification</span>]
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">ssl_specification</span> = <span class="ruby-constant">Hash</span>[<span class="ruby-string">'ssl_support'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">'disabled'</span> , <span class="ruby-string">'certificate_file'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">certificate</span>, <span class="ruby-string">'key_file'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">key</span>, <span class="ruby-string">'ssl_port'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ssl_port</span>]
    <span class="ruby-identifier">server_specification</span> = <span class="ruby-constant">Hash</span>[<span class="ruby-string">'port'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">port</span>, <span class="ruby-string">'min_worker'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">min_worker</span>, <span class="ruby-string">'max_worker'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">max_worker</span>, <span class="ruby-string">'log_level'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">log_level</span>, <span class="ruby-string">'access_log'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">access_log</span>.<span class="ruby-identifier">downcase</span>, <span class="ruby-string">'SSL Specification'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ssl_specification</span>]
  <span class="ruby-keyword">end</span>
  <span class="ruby-constant">ServerSpecification</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">info</span>, <span class="ruby-identifier">server_specification</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">error_message</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">text</span>, <span class="ruby-identifier">error_message</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- validate_and_write-source -->
            
          </div>

          

          
        </div><!-- validate_and_write-method -->

      
        <div id="write-method" class="method-detail ">
          <a name="method-c-write"></a>

          
          <div class="method-heading">
            <span class="method-name">write</span><span
              class="method-args">(info, server_specification)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Method is use to write server specification into the config file</p>
            

            
            <div class="method-source-code" id="write-source">
<pre>
<span class="ruby-comment"># File app/models/server_specification.rb, line 93</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">write</span>(<span class="ruby-identifier">info</span>, <span class="ruby-identifier">server_specification</span>)
  <span class="ruby-identifier">info</span>[<span class="ruby-string">'Server Specification'</span>] = <span class="ruby-identifier">server_specification</span>
  <span class="ruby-constant">YAMLWriter</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">info</span>, <span class="ruby-constant">CONFIG_FILE_PATH</span>, <span class="ruby-constant">YAMLConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- write-source -->
            
          </div>

          

          
        </div><!-- write-method -->

      
      </div><!-- public-class-method-details -->
    
    </div><!-- 5Buntitled-5D -->
  

  </div><!-- documentation -->

  <div id="validator-badges">
    <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
    <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
      Rdoc Generator</a> 2</small>.</p>
  </div>

</body>
</html>

